package com.ygl.common.entity;

import com.ygl.common.constant.DiscoveryConstant;

public enum WeightType {
	VERSION(DiscoveryConstant.VERSION, DiscoveryConstant.VERSION),
	REGION(DiscoveryConstant.REGION, DiscoveryConstant.REGION);

	private String value;
	private String description;

	private WeightType(String value, String description) {
		this.value = value;
		this.description = description;
	}

	public String getValue() {
		return value;
	}

	public String getDescription() {
		return description;
	}

	public static WeightType fromString(String value) {
		for (WeightType type : WeightType.values()) {
			if (type.getValue().equalsIgnoreCase(value)) {
				return type;
			}
		}

		throw new IllegalArgumentException("No matched type with value=" + value);
	}

	@Override
	public String toString() {
		return value;
	}
}
